import { fromJS } from 'immutable'
import * as actionTypes from './constant'

const defaultState = fromJS({
  singerList: [],
  enterLoading: true,
  pullUpLoading: false,
  pullDownLoading: false,
  // type: '-1',
  area: '-1',
  offset: 0
  // alpha: ''
})

export default (state = defaultState, action) => {
  switch (action.type) {
    case actionTypes.CHANGE_SINGER_LIST:
      return state.set('singerList', action.data)
    // case actionTypes.CHANGE_ALPHA:
    //   return state.set('alpha', action.data)
    // case actionTypes.CHANGE_TYPE:
    //   return state.set('type', action.data)
    case actionTypes.CHANGE_AREA:
      return state.set('area', action.data)
    case actionTypes.CHANGE_OFFSET:
      return state.set('offset', action.data)
    case actionTypes.CHANGE_ENTER_LOADING:
      return state.set('enterLoading', action.data)
    case actionTypes.CHANGE_PULLUP_LOADING:
      return state.set('pullUpLoading', action.data)
    case actionTypes.CHANGE_PULLDOWN_LOADING:
      return state.set('pullDownLoading', action.data)
    default:
      return state
  }
}
